import request from '@/utils/request'

const api = {
  findRoleByPage: '/role/findRoleByPage',
  addRole: '/role/addRole',
  updateRole: '/role/updateRole',
  deleteByRoleId: '/role/deleteByRoleId',
  assignRolePermission: '/role/assignRolePermission',
}

export default api

export function findRoleByPage (parameter) {
  return request({
    url: api.findRoleByPage,
    method: 'get',
    params: parameter
  })
}

export function addRole (parameter) {
  return request({
    url: api.addRole,
    method: 'post',
    data: parameter
  })
}

export function assignRolePermission (parameter) {
  return request({
    url: api.assignRolePermission,
    method: 'post',
    data: parameter
  })
}
export function updateRole (parameter) {
  return request({
    url: api.updateRole,
    method: 'post',
    data: parameter
  })
}
export function deleteByRoleId (parameter) {
  return request({
    url: api.deleteByRoleId,
    method: 'post',
    params: parameter
  })
}
